<?php

namespace App\Http\Controllers\Example;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

use GuzzleHttp\Client;

class OauthController extends Controller 
{
    public function pass(Request $request){
        $http = new Client();

    $response = $http->post('http://www.mytest.net/oauth/token', [
        'form_params' => [
            'grant_type' => 'authorization_code',
            'client_id' => '3',  // your client id
            'client_secret' => 'DTOJQfv84Jy5ykNuJI1pk4XWgolt1NGTGZEvMN3o',   // your client secret
            'redirect_uri' => 'http://www.mytest.net/auth/callback',
            'code' => $request->code,
        ],
    ]);
    
        return json_decode((string) $response->getBody(), true);
    }


}
